<?php
if (!defined('IN_XLP')) {
        exit('Access Denied');
}
$Document = array(
  'pageid' => 'guess-set', //页面标示
  'pagename' => '疯狂猜图栏目设置', //当前页面名称
  'mycss' => array(''), //加载的css样式表
  'myjs' => array(), //加载的js脚本
  'footerjs' => array(),
  'head' => true, //加载头部文件
);
include getTpl('header', 'public');
?>
<link rel="stylesheet" media="screen" href="<?php echo PUBLIC_PATH; ?>jquery-ui/css/smoothness/jquery-ui-1.10.0.custom.min.css"/>
<script type="text/javascript" src="<?php echo PUBLIC_PATH; ?>jquery-ui/js/jquery-ui-1.10.0.custom.min.js"></script>
<script type="text/javascript" src="<?php echo PUBLIC_PATH; ?>jquery-ui/js/jquery-ui-timepicker-addon.js"></script>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public'); ?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public'); ?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<section id="content">
        <section class="main padder">
                <div class="clearfix">
                        <h4><i class="fa fa-edit"></i><?php echo trim($Document['pagename'], '_'); ?></h4>
                </div>
                <div class="row">
                        <div class="col-sm-12">
                                <section class="panel">
                                        <div class="panel-body">
                                                <form class="form-horizontal" method="post" id="form1">

                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">活动名称</label>
                                                                <div class="col-sm-3">
                                                                        <input type="text" name="title" id="title" placeholder="" class="form-control" value="<?php echo $rs['title']; ?>" />
                                                                        <span class="help-block">标题不能长于64个字符</span></div>
                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">活动模板</label>
                                                                <div class="col-sm-2">
                                                                        <select name="skin_path" class="form-control" id="skin_path">
                                                                                <?php foreach ($tpls as $key => $val) { ?>
                                                                                        <option value="<?php echo $val['path']; ?>" <?php
                                                                                        if ($val['path'] == $rs['skin_path']) {
                                                                                                echo 'selected="selected"';
                                                                                        }
                                                                                        ?>><?php echo $key; ?></option>
                                                                                        <?php } ?>
                                                                        </select>
                                                                </div>
                                                        </div>               
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">关键字</label>
                                                                <div class="col-sm-2">
                                                                        <input class="form-control" type="text" id="keyword" name="keyword"  value="<?php echo $rs['keyword']; ?>"/></div>
                                                                        <span class="help-block">用户回复该关键字将触发这个活动，活动的关键词不能重复，且不建议包含标点符号</span>
                                                        </div>
                                                        
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">每日允许答题数</label>
                                                                <div class="col-sm-1">
                                                                        <input class="form-control" type="text" id="everyday" name="everyday" value="<?php echo $rs['everyday']?$rs['everyday']:0; ?>" /></div>
                                                                        <span class="help-block">每日允许答题数，0为不限制</span>
                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">分享到朋友圈后增加题目数</label>
                                                                <div class="col-sm-1">
                                                                        <input class="form-control" type="text" id="shares" name="shares" value="<?php echo $rs['shares']?$rs['shares']:0; ?>" /></div>
                                                                        <span class="help-block">单个用户分享到朋友圈后允许增加的题目数，0为不增加</span>
                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">已入住用户额外增加题目数</label>
                                                                <div class="col-sm-1">
                                                                        <input class="form-control" type="text" id="hasbind" name="hasbind" value="<?php echo $rs['hasbind']?$rs['hasbind']:0; ?>" /></div>
                                                                        <span class="help-block">已经绑定小区的用户额外增加题目数，0为不增加</span>
                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">连续答对题数</label>
                                                                <div class="col-sm-1">
                                                                        <input class="form-control" type="text" id="reward_t" name="reward_t" value="<?php echo $rs['reward_t']?$rs['reward_t']:0; ?>" /></div>
                                                                        <span class="help-block">设置用户连续答对数目</span>

                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">连续答对奖励分数</label>
                                                                <div class="col-sm-1">
                                                                        <input class="form-control" type="text" id="reward_i" name="reward_i" value="<?php echo $rs['reward_i']?$rs['reward_i']:0; ?>" /></div>
                                                                        <span class="help-block">设置用户连续答对题目达到标准所增加的分数</span>
                                                        </div>
                                                          <div class="form-group">
                                                                <label class="col-sm-2 control-label">用户出题奖励分数</label>
                                                                <div class="col-sm-1">
                                                                        <input class="form-control" type="text" id="topic" name="topic" value="<?php echo $rs['topic']?$rs['topic']:0; ?>" /></div>
                                                                        <span class="help-block">设置用户出题所赠积分</span>
                                                        </div>
                                                        <!---->
                                                        <hr style="border-bottom:0; border-top:1px #CCCCCC solid"/>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">分享标题</label>
                                                                <div class="col-sm-3">
                                                                        <input class="form-control" type="text" id="share_title" name="share_title" value="<?php echo $rs['share_title']; ?>" />
                                                                        <span class="help-block">用户分享给朋友或者朋友圈时显示的标题</span></div>
                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">分享内容</label>
                                                                <div class="col-sm-3">
                                                                        <textarea class="form-control textarea" id="textarea" name="share_content"><?php echo $rs['share_content']; ?></textarea>
                                                                        <span class="help-block">用户分享给朋友或者朋友圈时显示的内容</span></div>
                                                        </div>
                                                        <hr style="border-bottom:0; border-top:1px #CCCCCC solid"/>
                                                        <!---->
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">重复参加活动提醒语</label>
                                                                <div class="col-sm-3">
                                                                        <textarea class="form-control textarea" id="textarea" name="recontent"><?php echo $rs['recontent']; ?></textarea>
                                                                </div>
                                                        </div>
                                                        <div class="form-group">
                                                                <label class="col-sm-2 control-label">活动介绍</label>
                                                                <div class="col-sm-3">
                                                                        <textarea class="form-control textarea" id="textarea" name="content" style="height:100px"><?php echo $rs['content']; ?></textarea>
                                                                </div>
                                                        </div>
                                                        <div class="form-group"> 
                                                                <label style="width:100px;" class="col-sm-2 control-label"></label>
                                                                <div class="col-sm-6">
                                                                        <button class="btn btn-primary col-md-offset-4" id="sub-ok" type="submit">保存</button>
                                                                        <button class="btn btn-white col-md-offset-2" type="button" id="reset" >取消</button>
                                                                </div> 
                                                        </div>
                                                </form>
                                        </div>
                                </section>
                        </div>
                </div>
        </section>
</section>
<!--主体 结束--> 

<script>

        $(function() {
                $('#stime').datetimepicker();
                $('#etime').datetimepicker();
                $('#reset').click(function() {
                        document.location = '<?php echo U('guess/index'); ?>';
                });
                $('#form1').submit(function() {
                        var title = $.trim($("#title").val());
                        var isOk = true;
                        if (!title) {
                                Msg.error('名称不能为空');
                                resetSubmit("#sub-ok", '保存');
                                return false;
                        }
                        Msg.loading();
                        $.post('<?php echo U('guess/setpost'); ?>', $(this).serialize(), function(result) {
                                Msg.hide();
                                resetSubmit("#sub-ok", '保存');
                                if (result.status == 1) {
                                        Msg.ok('保存成功');
                                } else {
                                        Msg.error(result.info);
                                }
                        }, 'json');
                        return false;
                });
        })
</script>
<?php
include getTpl('footer', 'public');
?>